package com.scedu.controller;

import com.scedu.entity.Employee;
import com.scedu.service.EmployeeService;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/employee")
@Slf4j
public class EmployeeController {
    @Autowired
    private EmployeeService employeeService;

    @GetMapping("/findAll")
    public List<Employee> findAll(){
        List<Employee> employeeList=  employeeService.findAll();
        log.info("查询结果是{}",employeeList);
        return  employeeList;



    }

    @GetMapping("/save")
    public  void save(Employee employee){
        employeeService.save(employee);
    }
}
